
package com.idealighter.game.roomcard.common;

import com.idealighter.game.games.common.AbstractRoom;

import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

import lombok.Getter;
import lombok.Setter;

/**
 * 游戏房间 .
 * 
 * 
 * @date 2015年8月6日 下午6:08:31
 *
 */
public abstract class AbstractRoomCardRoom extends AbstractRoom {
  public static final Integer STANDER_BY_SEAT_NUM = 100;
  // 所有者编号
  @Getter
  private final Long ownerId;
  @Getter
  private final int groupId; // 所属的群,0:不属于群
  @Getter
  private final int maxSeatNum; // 座位数量
  @Getter
  private final int maxByStanderNum = STANDER_BY_SEAT_NUM; // 旁观者数量
  @Getter
  @Setter
  private Date roundStartTime; // 每一局开始时间
  @Getter
  private AtomicInteger seatDownNum = new AtomicInteger(0); // 坐下的人数量

  /**
   * 构造函数.
   * 
   * @param roomId 房间编号.
   * @param roomName 房间名称.
   * @param ownerId 房主编号.
   * @param groupId 群编号(0:不属于任何群).
   * @param maxSeatNum 桌子数量.
   */
  public AbstractRoomCardRoom(long roomId, String roomName, long ownerId, int groupId,
      int maxSeatNum) {
    super(roomId, roomName);
    this.ownerId = ownerId;
    this.groupId = groupId;
    this.maxSeatNum = maxSeatNum; // 包含的作为数
    // this.maxByStanderNum = maxByStanderNum; // 旁观者数量

  }

  public boolean hasPlayer(long playerId) {
    return players.contains(playerId);
  }
}
